package com.yunxi.service.dubboService.impl.dealer;

import com.github.pagehelper.PageInfo;
import com.yunxi.dealer.pojo.PartnerInvoiceRecordVO;
import com.yunxi.dealer.service.PartnerInvoiceRecordDubboService;
import com.yunxi.model.dealer.PartnerInvoiceRecord;
import com.yunxi.service.localService.dealer.PartnerInvoiceRecordService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * <p>
 * 渠道商开票记录 服务实现类
 * </p>
 *
 * @author 
 * @since 2019-05-27
 */
//@com.alibaba.dubbo.config.annotation.Service(version = "${demo.service.version}",
//        application = "${dubbo.application.id}",
//        protocol = "${dubbo.protocol.id}",
//        registry = "${dubbo.registry.id}"
//)
public class PartnerInvoiceRecordDubboServiceImpl implements PartnerInvoiceRecordDubboService {

    @Autowired
    @Qualifier(value = "partnerInvoiceRecordServiceImpl")
    PartnerInvoiceRecordService partnerInvoiceRecordService;


    @Override
    public PartnerInvoiceRecordVO getById(String id) throws InvocationTargetException, IllegalAccessException {
    PartnerInvoiceRecord partnerInvoiceRecord = partnerInvoiceRecordService.getById(id);
    PartnerInvoiceRecordVO partnerInvoiceRecordVO = new PartnerInvoiceRecordVO();
        BeanUtils.copyProperties(partnerInvoiceRecord,partnerInvoiceRecordVO);
        return partnerInvoiceRecordVO;
    }

    @Override
    public void saveOrUpdate(PartnerInvoiceRecordVO partnerInvoiceRecordVO) throws InvocationTargetException, IllegalAccessException {
    PartnerInvoiceRecord partnerInvoiceRecord = new PartnerInvoiceRecord();
        BeanUtils.copyProperties(partnerInvoiceRecordVO,partnerInvoiceRecord);
    partnerInvoiceRecordService.saveOrUpdate(partnerInvoiceRecord);
    }

    @Override
    public void removeById(String id) {
    partnerInvoiceRecordService.removeById(id);
    }

    @Override
    public PageInfo<PartnerInvoiceRecordVO> findPageByVO(PartnerInvoiceRecordVO partnerInvoiceRecordVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {
      PageInfo<PartnerInvoiceRecordVO> pageInfo = partnerInvoiceRecordService.pageByVo(partnerInvoiceRecordVO,pageNum,pageSize);
      return pageInfo;
   }

    @Override
    public void removeByListVo(List<PartnerInvoiceRecordVO> partnerInvoiceRecordVOList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
        partnerInvoiceRecordService.removeByListVo(partnerInvoiceRecordVOList);
    }
}
